﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Asteroids.Game
{
    public class Coordinate
    {
        public Coordinate(double x, double y)
        {
            X = x;
            Y = y;
        }

        public double X { get; set; }
        public double Y { get; set; }

        public static implicit operator PolarCoordinate(Coordinate c1)
        {
            return new PolarCoordinate(Math.Atan2(c1.Y, c1.X), Math.Sqrt(Math.Pow(c1.X, 2) + Math.Pow(c1.Y, 2)));
        }

        public static Coordinate operator +(Coordinate c1, Coordinate c2)
        {
            return new Coordinate(c1.X + c2.X, c1.Y + c2.Y);
        }

        public static Coordinate operator -(Coordinate c1, Coordinate c2)
        {
            return new Coordinate(c1.X - c2.X, c1.Y - c2.Y);
        }

        public override string ToString()
        {
            return String.Format("X: {0}\t\tY: {1}", X, Y);
        }
    }
}
